<html>
<head><meta charset="utf-8"><title>Unintentional lifetime captures using impl Trait · general · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/index.html">general</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Unintentional.20lifetime.20captures.20using.20impl.20Trait.html">Unintentional lifetime captures using impl Trait</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="170565978"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Unintentional%20lifetime%20captures%20using%20impl%20Trait/near/170565978" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Unintentional.20lifetime.20captures.20using.20impl.20Trait.html#170565978">(Jul 10 2019 at 18:20)</a>:</h4>
<p>This code returns an <code>impl Trait</code> that completely owns the value, but the error indicates that the argument's lifetime is being captured as well. Is there a way to avoid the unintended capture?</p>
<div class="codehilite"><pre><span></span><span class="k">fn</span> <span class="nf">make_debug</span><span class="o">&lt;</span><span class="n">T</span><span class="o">&gt;</span><span class="p">(</span><span class="n">_</span>: <span class="nc">T</span><span class="p">)</span><span class="w"> </span>-&gt; <span class="nc">impl</span><span class="w"> </span><span class="n">std</span>::<span class="n">fmt</span>::<span class="n">Debug</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="mi">42</span><span class="k">u8</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">test</span><span class="p">()</span><span class="w"> </span>-&gt; <span class="nc">impl</span><span class="w"> </span><span class="n">std</span>::<span class="n">fmt</span>::<span class="n">Debug</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="kd">let</span><span class="w"> </span><span class="n">value</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">&quot;value&quot;</span><span class="p">.</span><span class="n">to_string</span><span class="p">();</span><span class="w"></span>
<span class="w">    </span><span class="n">make_debug</span><span class="p">(</span><span class="o">&amp;</span><span class="n">value</span><span class="p">)</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</pre></div>


<div class="codehilite"><pre><span></span>error[E0597]: `value` does not live long enough
 --&gt; src/lib.rs:7:16
  |
5 | fn test() -&gt; impl std::fmt::Debug {
  |              -------------------- opaque type requires that `value` is borrowed for `&#39;static`
6 |     let value = &quot;value&quot;.to_string();
7 |     make_debug(&amp;value)
  |                ^^^^^^ borrowed value does not live long enough
8 | }
  | - `value` dropped here while still borrowed
</pre></div>



<a name="170644713"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Unintentional%20lifetime%20captures%20using%20impl%20Trait/near/170644713" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Unintentional.20lifetime.20captures.20using.20impl.20Trait.html#170644713">(Jul 11 2019 at 15:36)</a>:</h4>
<p>there's at least an issue for this somewhere that maybe contains some hints...</p>



<a name="170644798"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Unintentional%20lifetime%20captures%20using%20impl%20Trait/near/170644798" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Unintentional.20lifetime.20captures.20using.20impl.20Trait.html#170644798">(Jul 11 2019 at 15:37)</a>:</h4>
<p>ah I misremembered, that's not the problem I ran into once</p>



<a name="170644888"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Unintentional%20lifetime%20captures%20using%20impl%20Trait/near/170644888" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Unintentional.20lifetime.20captures.20using.20impl.20Trait.html#170644888">(Jul 11 2019 at 15:38)</a>:</h4>
<p><span class="user-mention" data-user-id="116155">@Jake Goulding</span> I think changing the return type to <code>impl Debug + 'static</code> should help</p>



<a name="170644937"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Unintentional%20lifetime%20captures%20using%20impl%20Trait/near/170644937" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Unintentional.20lifetime.20captures.20using.20impl.20Trait.html#170644937">(Jul 11 2019 at 15:38)</a>:</h4>
<p>hm, seems like it does not</p>



<a name="170644940"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Unintentional%20lifetime%20captures%20using%20impl%20Trait/near/170644940" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Unintentional.20lifetime.20captures.20using.20impl.20Trait.html#170644940">(Jul 11 2019 at 15:38)</a>:</h4>
<p>that's odd?</p>



<a name="170644953"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Unintentional%20lifetime%20captures%20using%20impl%20Trait/near/170644953" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Unintentional.20lifetime.20captures.20using.20impl.20Trait.html#170644953">(Jul 11 2019 at 15:39)</a>:</h4>
<p>Right? :-)</p>



<a name="170644972"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Unintentional%20lifetime%20captures%20using%20impl%20Trait/near/170644972" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Unintentional.20lifetime.20captures.20using.20impl.20Trait.html#170644972">(Jul 11 2019 at 15:39)</a>:</h4>
<p>I would try <code>let v = make_debug(&amp;value); v</code> myself, but not sure</p>



<a name="170644996"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Unintentional%20lifetime%20captures%20using%20impl%20Trait/near/170644996" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Unintentional.20lifetime.20captures.20using.20impl.20Trait.html#170644996">(Jul 11 2019 at 15:39)</a>:</h4>
<p>ah I guess that's a different bug</p>



<a name="170645158"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Unintentional%20lifetime%20captures%20using%20impl%20Trait/near/170645158" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Unintentional.20lifetime.20captures.20using.20impl.20Trait.html#170645158">(Jul 11 2019 at 15:41)</a>:</h4>
<p><span class="user-mention" data-user-id="120791">@RalfJ</span> I'm also pretty sure that the original uses <code>'static</code> implicitly: <em>opaque type requires that <code>value</code> is borrowed for <code>'static</code></em></p>



<a name="170645293"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Unintentional%20lifetime%20captures%20using%20impl%20Trait/near/170645293" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Unintentional.20lifetime.20captures.20using.20impl.20Trait.html#170645293">(Jul 11 2019 at 15:42)</a>:</h4>
<p>it should say "whatever type actually is behind this <code>impl Trait</code> outlives static"</p>



<a name="170645301"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Unintentional%20lifetime%20captures%20using%20impl%20Trait/near/170645301" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Unintentional.20lifetime.20captures.20using.20impl.20Trait.html#170645301">(Jul 11 2019 at 15:42)</a>:</h4>
<p>aka "didnt capture any non-static references"</p>



<a name="170645304"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Unintentional%20lifetime%20captures%20using%20impl%20Trait/near/170645304" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Unintentional.20lifetime.20captures.20using.20impl.20Trait.html#170645304">(Jul 11 2019 at 15:43)</a>:</h4>
<p>which is what we want here</p>



<a name="170645500"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Unintentional%20lifetime%20captures%20using%20impl%20Trait/near/170645500" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Unintentional.20lifetime.20captures.20using.20impl.20Trait.html#170645500">(Jul 11 2019 at 15:45)</a>:</h4>
<p>I feel like this might actually be intentional in some way, but I'm not sure</p>



<a name="170645510"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Unintentional%20lifetime%20captures%20using%20impl%20Trait/near/170645510" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Unintentional.20lifetime.20captures.20using.20impl.20Trait.html#170645510">(Jul 11 2019 at 15:45)</a>:</h4>
<p>It certainly isn't great from a usability perspective</p>



<a name="170645525"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Unintentional%20lifetime%20captures%20using%20impl%20Trait/near/170645525" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Unintentional.20lifetime.20captures.20using.20impl.20Trait.html#170645525">(Jul 11 2019 at 15:45)</a>:</h4>
<p>but I seem to recall some discussion around impl trait today basically "capturing" all input lifetimes</p>



<a name="170645546"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Unintentional%20lifetime%20captures%20using%20impl%20Trait/near/170645546" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Unintentional.20lifetime.20captures.20using.20impl.20Trait.html#170645546">(Jul 11 2019 at 15:45)</a>:</h4>
<p>The original SO question points out that changing to <code>make_debug&lt;T&gt;(_: &amp;T)</code> allows it to work</p>



<a name="170645604"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Unintentional%20lifetime%20captures%20using%20impl%20Trait/near/170645604" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Unintentional.20lifetime.20captures.20using.20impl.20Trait.html#170645604">(Jul 11 2019 at 15:46)</a>:</h4>
<p>right -- I think that's connected to the lifetime becoming "visible"</p>



<a name="170645623"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Unintentional%20lifetime%20captures%20using%20impl%20Trait/near/170645623" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Unintentional.20lifetime.20captures.20using.20impl.20Trait.html#170645623">(Jul 11 2019 at 15:46)</a>:</h4>
<p>And <code>fn make_debug&lt;T&gt;(_: T) -&gt; Box&lt;dyn std::fmt::Debug&gt;</code> also works</p>



<a name="170645678"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Unintentional%20lifetime%20captures%20using%20impl%20Trait/near/170645678" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Unintentional.20lifetime.20captures.20using.20impl.20Trait.html#170645678">(Jul 11 2019 at 15:47)</a>:</h4>
<p>neither "hide" the lifetime in T though</p>



<a name="170645751"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Unintentional%20lifetime%20captures%20using%20impl%20Trait/near/170645751" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Unintentional.20lifetime.20captures.20using.20impl.20Trait.html#170645751">(Jul 11 2019 at 15:48)</a>:</h4>
<p>Why doesn't the <code>Box</code> version "hide" it?</p>



<a name="170645761"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Unintentional%20lifetime%20captures%20using%20impl%20Trait/near/170645761" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Unintentional.20lifetime.20captures.20using.20impl.20Trait.html#170645761">(Jul 11 2019 at 15:48)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/issues/42940" target="_blank" title="https://github.com/rust-lang/rust/issues/42940">#42940</a></p>



<a name="170645824"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Unintentional%20lifetime%20captures%20using%20impl%20Trait/near/170645824" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Unintentional.20lifetime.20captures.20using.20impl.20Trait.html#170645824">(Jul 11 2019 at 15:49)</a>:</h4>
<p>Yeah, that's definitely the issue I was thinking about</p>



<a name="170645882"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Unintentional%20lifetime%20captures%20using%20impl%20Trait/near/170645882" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Unintentional.20lifetime.20captures.20using.20impl.20Trait.html#170645882">(Jul 11 2019 at 15:50)</a>:</h4>
<p><span class="user-mention" data-user-id="120791">@RalfJ</span> ^ in case you're interested</p>



<a name="170646095"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Unintentional%20lifetime%20captures%20using%20impl%20Trait/near/170646095" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Unintentional.20lifetime.20captures.20using.20impl.20Trait.html#170646095">(Jul 11 2019 at 15:53)</a>:</h4>
<p>Doesn't look like the one workaround mentioned applies here, unless I misunderstood:</p>
<div class="codehilite"><pre><span></span><span class="k">trait</span><span class="w"> </span><span class="n">DebugStatic</span>: <span class="nc">std</span>::<span class="n">fmt</span>::<span class="n">Debug</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="nb">&#39;static</span><span class="w"> </span><span class="p">{}</span><span class="w"></span>
<span class="k">impl</span><span class="o">&lt;</span><span class="n">T</span><span class="o">&gt;</span><span class="w"> </span><span class="n">DebugStatic</span><span class="w"> </span><span class="k">for</span><span class="w"> </span><span class="n">T</span><span class="w"> </span><span class="k">where</span><span class="w"> </span><span class="n">T</span>: <span class="nc">std</span>::<span class="n">fmt</span>::<span class="n">Debug</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="nb">&#39;static</span><span class="w"> </span><span class="p">{}</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">make_debug</span><span class="o">&lt;</span><span class="n">T</span><span class="o">&gt;</span><span class="p">(</span><span class="n">_</span>: <span class="nc">T</span><span class="p">)</span><span class="w"> </span>-&gt; <span class="nc">impl</span><span class="w"> </span><span class="n">DebugStatic</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="nb">Box</span>::<span class="n">new</span><span class="p">(</span><span class="mi">42</span><span class="k">u8</span><span class="p">)</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">test</span><span class="p">()</span><span class="w"> </span>-&gt; <span class="nc">impl</span><span class="w"> </span><span class="n">DebugStatic</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="kd">let</span><span class="w"> </span><span class="n">value</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">&quot;value&quot;</span><span class="p">.</span><span class="n">to_string</span><span class="p">();</span><span class="w"></span>
<span class="w">    </span><span class="n">make_debug</span><span class="p">(</span><span class="o">&amp;</span><span class="n">value</span><span class="p">)</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</pre></div>



<a name="170646184"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Unintentional%20lifetime%20captures%20using%20impl%20Trait/near/170646184" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Unintentional.20lifetime.20captures.20using.20impl.20Trait.html#170646184">(Jul 11 2019 at 15:54)</a>:</h4>
<p>ah, do you have a link to the comment?</p>



<a name="170646907"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Unintentional%20lifetime%20captures%20using%20impl%20Trait/near/170646907" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Unintentional.20lifetime.20captures.20using.20impl.20Trait.html#170646907">(Jul 11 2019 at 16:03)</a>:</h4>
<p><span class="user-mention" data-user-id="116122">@simulacrum</span> <a href="https://github.com/rust-lang/rust/issues/42940#issuecomment-452756105" target="_blank" title="https://github.com/rust-lang/rust/issues/42940#issuecomment-452756105">https://github.com/rust-lang/rust/issues/42940#issuecomment-452756105</a></p>



<a name="170647000"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Unintentional%20lifetime%20captures%20using%20impl%20Trait/near/170647000" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Unintentional.20lifetime.20captures.20using.20impl.20Trait.html#170647000">(Jul 11 2019 at 16:04)</a>:</h4>
<p>hm -- so I think that looks slightly different, since it's nested impl trait</p>



<a name="170647043"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Unintentional%20lifetime%20captures%20using%20impl%20Trait/near/170647043" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Unintentional.20lifetime.20captures.20using.20impl.20Trait.html#170647043">(Jul 11 2019 at 16:05)</a>:</h4>
<p>I suspect that was like, actually a bug, whereas the behavior we're seeing is intentional</p>



<a name="170647063"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Unintentional%20lifetime%20captures%20using%20impl%20Trait/near/170647063" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Unintentional.20lifetime.20captures.20using.20impl.20Trait.html#170647063">(Jul 11 2019 at 16:05)</a>:</h4>
<p>(or, currently intentional, I think)</p>



<a name="170650158"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Unintentional%20lifetime%20captures%20using%20impl%20Trait/near/170650158" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Unintentional.20lifetime.20captures.20using.20impl.20Trait.html#170650158">(Jul 11 2019 at 16:44)</a>:</h4>
<p>but how is it not a bug if a type explicitly marked <code>'static</code> is not static?</p>



<a name="170654931"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Unintentional%20lifetime%20captures%20using%20impl%20Trait/near/170654931" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Unintentional.20lifetime.20captures.20using.20impl.20Trait.html#170654931">(Jul 11 2019 at 17:41)</a>:</h4>
<p>hm -- yeah, not sure</p>



<a name="170654936"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Unintentional%20lifetime%20captures%20using%20impl%20Trait/near/170654936" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Unintentional.20lifetime.20captures.20using.20impl.20Trait.html#170654936">(Jul 11 2019 at 17:41)</a>:</h4>
<p>that might be abug</p>



<a name="170654952"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Unintentional%20lifetime%20captures%20using%20impl%20Trait/near/170654952" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Unintentional.20lifetime.20captures.20using.20impl.20Trait.html#170654952">(Jul 11 2019 at 17:41)</a>:</h4>
<p>but I think the idea of capturing T's lifetime is probably not one</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>